﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Collections;

namespace BLO
{
    /// <summary>
    /// Summary description for Album
    /// </summary>
    public class Album
    {
        DTO.Album info;
        DAO.Album albumDAO;

        public Album()
        {
            this.albumDAO = new DAO.Album();
            this.info = new DTO.Album();
        }

           /// <summary>
        /// Album Information.
        /// </summary>
        public DTO.Album Info
        {
            get { return this.info; }
            set { this.info = value; }
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="ID"></param>
        public static Album GetAlbum(String ID)
        {
            DAO.Album albumDAO = new DAO.Album();
            Album album = new  Album();
            album.Info = albumDAO.GetAlbum(ID);
            return album;
        }
        public static String GetNameAlbum(String ID)
        {
            return DAO.Album.LayTenAlbum(ID);
        }
        public static ArrayList GetAlbumWithUserId(string userID)
        {
            DAO.Album albumDAO = new DAO.Album();
            return albumDAO.GetAlbumWithUserId(userID);
        }
        /// <summary>
        /// Insert Album information to database.
        /// </summary>
        public int Insert()
        {
            return albumDAO.InsertAlbum(this.info);
        }

        /// <summary>
        /// Update information to database.
        /// </summary>
        public void Update()
        {
            albumDAO.UpdateAlbum(this.info);
        }

        /// <summary>
        /// Re-get all information from database about this Albums.
        /// </summary>
        public void Refresh()
        {
            this.info = albumDAO.GetAlbum(this.info.ID.ToString());
        }

        /// <summary>
        /// Delete this news from database.
        /// </summary>
        public void Delete()
        {
            albumDAO.DeleteAlbum(this.info);
        }
    }
}